home *** CD-ROM | disk | FTP | other *** search
- Path: rover.ucs.ualberta.ca!mcbride
- From: mcbride@ee.ualberta.ca (Darin McBride)
- Newsgroups: comp.lang.c,comp.os.os2.programmer.misc
- Subject: Re: redefining stdout and stderr
- Followup-To: comp.lang.c,comp.os.os2.programmer.misc
- Date: 22 Jan 1996 18:15:08 GMT
- Organization: University of Alberta Electrical Engineering Department
- Message-ID: <4e0k7c$1tgm@pulp.ucs.ualberta.ca>
- References: <DKw9Cv.2x4@fyi.net>
- NNTP-Posting-Host: hp10.ee.ualberta.ca
- X-Newsreader: TIN [version 1.2 PL2]
-
- fireresq@fyi.net wrote:
- > everyting I am doing is running on OS/2 Warp Connect and using the IBM
- > Set++ compiler.
-
- > I have a program that I have converted form an exe to a DLL. I used many
- > printf's for debug and status information.
-
- > What I want to do is cause stdout and stderr to go to a file but since
- > this dll will be called from VisualAge I cannot redirect the output with >.
-
- > I need to change the assocation of stdout and stderr programaticly. I
- > would be open for suggestions.
-
- > I need a way to close stdout and stderr. then reopen them redircted to a
- > file from inside my dll.
-
- For future readability's sake, I recommend not doing this... you may not
- remember 6 months down the road why your printf's aren't printing
- anything...
-
- I would recommend possibly something along the lines of creating a FILE*
- that was global, for example, FILE* mylog, and initializing it. Then
- you would have to use fprintf(mylog, format, ...) rather than
- printf(format, ...). It would require changes this way and I see why
- you may not want to do this, however being a maintanence programmer, I'd
- much rather read 'fprintf(mylog, "nValue is %d", nValue)' where I know
- it's in a logfile to 'printf("nValue is %d", nValue)' where I would
- assume it was going to stdout (i.e., the screen).
-
- --
- Darin McBride:mcbride@ee.ualberta.ca/mcbride@tower.bohica.net
-
- Enjoy each day as if it were your last, care about each moment as if
- it were your last for one day, one moment, you *will* be right!
-
- Tips & Tricks for IBM Hardware, MSDOS, OS2, Windows (including Win'95):
- http://www.ee.ualberta.ca/~mcbride/tiptrick.html
-